package day06_exception_collection.com.itheima.d1_exception;

public class Demo3_Exception {
    public static void main(String[] args) {
        System.out.println("开始。。。");
        try {
            save(203);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("程序出现异常，请稍后再试");
        }
        System.out.println("结束。。。");
    }
    public static void save(int age){
        if (age <= 0 || age > 150){
            throw new IllegalArgumentException("年龄有误");
        }
        System.out.println("保存成功" + age + "岁");
    }
}
